/*
 * find_marker_client.cpp
 *
 *  Created on: Dec 18, 2012
 *      Author: michiel
 */

#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include "rp_states/FindMarkerAction.h"

typedef actionlib::SimpleActionClient<rp_states::FindMarkerAction> Client;

int main(int argc, char** argv) {
	ros::init(argc, argv, "find_marker_client");

	actionlib::SimpleActionClient<rp_states::FindMarkerAction> client("find_marker", true);
	ROS_INFO("Waiting for server to start.");
	client.waitForServer();
	ROS_INFO("Server started, sending goal");
	rp_states::FindMarkerGoal goal;
	goal.marker_id = 0;
	client.sendGoal(goal);
	client.waitForResult(ros::Duration(5.0));

	if (client.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) {
		ROS_INFO("Marker found!");
	}
	ROS_INFO("Current State: %s", client.getState().toString().c_str());

	return 0;
}
